;NSIS Modern User Interface
;Basic Example Script
;Written by Joost Verburg

;--------------------------------
;Include Modern UI

  !include "MUI.nsh"

;--------------------------------
;General


  ;Name and file
  Name "WAR Combat Tracker"
  OutFile "WarCTSetup.exe"

  ;Default installation folder
  InstallDir "$PROGRAMFILES\WAR Combat Tracker"
  
  ;Get installation folder from registry if available
  InstallDirRegKey HKCU "Software\WAR Combat Tracker" ""

;--------------------------------
;Interface Settings

  !define MUI_ABORTWARNING

;--------------------------------
;Pages

  !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
  !insertmacro MUI_PAGE_COMPONENTS
  !insertmacro MUI_PAGE_DIRECTORY
  !insertmacro MUI_PAGE_INSTFILES
  
  !insertmacro MUI_UNPAGE_CONFIRM
  !insertmacro MUI_UNPAGE_INSTFILES
  
;--------------------------------
;Languages
 
  !insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Installer Sections

Section "WAR Combat Tracker" SecDummy


;ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion"
;ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$1" "JavaHome"
;ReadRegStr $3 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$1" "MicroVersion"
;StrCpy $1 "$1.$6"
 
;IfErrors 0 NoAbort
 ;   MessageBox MB_OK "No Java Development Kit found."       
  ;  Goto Abort
 
;NoAbort:
 ;   MessageBox MB_OK "Java Development Kit version $1 found."
 
;Abort:
  ;Abort
    ; bleh

  SetOutPath "$INSTDIR"
  
  ;ADD YOUR OWN FILES HERE...
;  CreateShortCut "$DESKTOP\WAR Combat Tracker.lnk" "$INSTDIR\WAR Combat Tracker.lnk"
  CreateDirectory "$INSTDIR\lib"
  file "C:\Documents and Settings\Me\Desktop\Code\WarCT\dist\lib\*"
  CopyFiles "$INSTDIR\*" "$INSTDIR\lib"
  Delete "$INSTDIR\*.jar"
  file "C:\Documents and Settings\Me\Desktop\Code\WarCT\dist\WarCT.jar"
  file "C:\Documents and Settings\Me\Desktop\Code\WarCT\abilities.xml"
  file "C:\Documents and Settings\Me\Desktop\Code\WarCT\start2.PNG"
  file "C:\Documents and Settings\Me\Desktop\Code\WarCT\pause2.PNG"
  file "C:\Documents and Settings\Me\Desktop\Code\WarCT\stop2.PNG"
  file "C:\Documents and Settings\Me\Desktop\Code\WarCT\start.bat"
  file "C:\Documents and Settings\Me\Desktop\Code\WarCT\start1.bat"
  file "C:\Documents and Settings\Me\Desktop\Code\WarCT\war.ico"
  file "C:\Documents and Settings\Me\Desktop\Code\WarCT\WAR.gif"
  file "C:\Documents and Settings\Me\Desktop\Code\WarCT\pslist.exe"
  file "C:\Documents and Settings\Me\Desktop\Code\WarCT\WAR Combat Tracker.lnk"
  CopyFiles "$INSTDIR\WAR Combat Tracker.lnk" "$DESKTOP\WAR Combat Tracker.lnk"
  
  ;Store installation folder
  WriteRegStr HKCU "Software\WAR Combat Tracker" "" $INSTDIR
  
  ;Create uninstaller
  WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd

;--------------------------------
;Descriptions

  ;Language strings
  LangString DESC_SecDummy ${LANG_ENGLISH} "The WAR Combat Tracker application."

  ;Assign language strings to sections
  !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
    !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
  !insertmacro MUI_FUNCTION_DESCRIPTION_END

;--------------------------------
;Uninstaller Section

Section "Uninstall"

  ;ADD YOUR OWN FILES HERE...

  Delete "$INSTDIR\Uninstall.exe"
  Delete "$INSTDIR\WarCT.jar"
  RMDir "$INSTDIR"

  DeleteRegKey /ifempty HKCU "Software\WAR Combat Tracker"

SectionEnd